package com.specdot.kraster.math;

public class Matrix {
	protected int nRow, nCol;
	protected float[] rawValue;
	
	public Matrix(int nRow, int nCol) {
		this.nRow = nRow;
		this.nCol = nCol;

		this.rawValue = new float[nRow * nCol];
	}
	
	public Matrix(int nRow, int nCol, float[] value) {
		this.nRow = nRow;
		this.nCol = nCol;
		
		this.rawValue = value;
	}
	
	public void setCell(int row, int col, float value) {
		int idx = row * nCol + col;
		if (idx < 0 || idx >= nRow * nCol)
			return;
		rawValue[idx] = value;
	}
	
	public float getCell(int row, int col) {
		int idx = row * nCol + col;
		if (idx < 0 || idx >= nRow * nCol)
			return 0;
		return rawValue[idx];
	}
}
